<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/displaytag.tld" prefix="display"%>
<%@ page import="java.util.*"%>
<%@ page
	import="co.gov.medellin.ssti.sub.model.vo.RepDetBOTVO,co.gov.medellin.ssti.sub.model.vo.RepAtributoVO"%>

<html>
<head>
<script type="text/javascript"
	src="<%=request.getContextPath() + "/js/popUP.js"%>"></script>
<link href="<%=request.getContextPath() + "/css/bloques.css"%>"
	rel="stylesheet" type="text/css">

<script type="text/javascript">
  function buscar(){
    document.frmpermisosreportes.btnasignar.disabled = true;
    document.frmpermisosreportes.action = '<%=request.getContextPath() + "/User/PermissionsReport.do"%>';
    document.frmpermisosreportes.submit();
  }
  
  function buscar1(){  
    if(event.keyCode==13){
      document.frmpermisosreportes.action = '<%=request.getContextPath() + "/User/PermissionsReport.do"%>';
      document.frmpermisosreportes.submit();
    }
  }
  
  function activar(){  
      document.frmpermisosreportes.btnasignar.disabled = false;
  }
  
  function validarOtros(tamano)
  {
    var nom = "";
    var marcado = false;
    var i;
    for (i = 0; i < tamano; i++) 
    {
      nom = "codeusuario"+i;
      if (document.forms['frmpermisosreportes'].elements[nom].checked) 
      {
        marcado = true;
        break;
      }  
    } 
    if (marcado == false)
    {
      alert('Por favor seleccione una opcion.');
    }else
    {
      document.frmpermisosreportes.submit();
    }
  }
  
  function enviar(locacion1)
  {
    document.frmpermisosreportes.action=locacion1;
    document.frmpermisosreportes.submit();
  }
    
</script>

<script src="<%=request.getContextPath()%>/js/displaytag.js"
	type="text/javascript"></script>
</head>
<body>
	<form name="frmpermisosreportes"
		action="<%=request.getContextPath()
					+ "/User/SelectionPermissionReport.do"%>"
		method="get">
		<input type="hidden" name="search" value="search">

		<%
			List lUsuarios = new LinkedList();
			lUsuarios = (List) session.getAttribute("ListaUsuarios");
			int tamano = lUsuarios.size();
		%>
		<table style="width: 99%; border: 0; padding: 0; border-spacing: 0;">

			<tr>
				<td height="25" colspan="12" align="center" class="titulosenblanco"><strong>
						CRITERIOS DE BUSQUEDA DE USUARIOS</strong></td>
			</tr>

			<tr align="left">
				<td height="25" colspan="12" class="titulosenblanco"><table
						style="border: 0; padding: 0; border-spacing: 0; width: 99%;">

					</table></td>
			</tr>
			<tr align="left">
				<td width="100%" align="center">
					<table
						style="width: 70%; border: 0; padding: 3px; border-spacing: 3px;">
						<tr>
							<td width="7%">&nbsp;</td>
							<td width="22%" align="left" class="celdatabla"><strong>Usuario</strong>
							</td>
							<td width="61%"><input type="text" name="nameuser"
								onkeypress="buscar1()" /></td>
							<td width="10%">&nbsp;</td>
						</tr>

						<tr>
							<td width="7%">&nbsp;</td>


							<td width="10%">&nbsp;</td>
						</tr>
						<tr>
							<td width="7%">&nbsp;</td>
							<td width="22%">&nbsp;</td>
							<td width="61%"><input type="button" name="Submit"
								onclick="buscar()" value="Buscar"></td>
							<td width="10%">&nbsp;</td>
						</tr>
						<tr>
							<td colspan="4">&nbsp;</td>
						</tr>
						<tr>
							<td width="7%">&nbsp;</td>
							<td width="22%">&nbsp;</td>
							<td width="61%">&nbsp;</td>
							<td width="10%">&nbsp;</td>
						</tr>
					</table>
				</td>
			</tr>





			<tr>
				<td colspan="12" align="left"><logic:present
						name="ListaUsuarios">

						<%
							int p = 0;
						%>
						<display:table name="sessionScope.ListaUsuarios" id="Usuario"
							pagesize="20" cellpadding="3" cellspacing="1" style="width:100%"
							class="bordestable">

							<display:column headerClass="headerTable" title="NOMBRE"
								class="Numero" sortable="true" property="nombreUsuario"></display:column>
							<display:column headerClass="headerTable" title="DESCRIPCION"
								class="Numero" sortable="true" property="descripcion"></display:column>
							<display:column headerClass="headerTable" title="GRUPO USUARIO"
								class="Numero" sortable="true" property="nombreGrupo"></display:column>
							<display:column headerClass="headerTable" title="SELECCIONAR">
								<DIV align="center">
									<bean:define name="Usuario" id="Usuarios"
										property="codeUsuario"></bean:define>
									<%
										String nom = Usuarios + "";
													String nameus = "codeusuario" + p;
													p += 1;
									%>
									<input type="checkbox" onclick="activar()" name="<%=nameus%>"
										value="<%=nom%>" />
								</DIV>
							</display:column>

						</display:table>
					</logic:present></td>
			</tr>
		</table>

		<P align="center">
			<input disabled="disabled" type="button" value="Continuar"
				onclick="validarOtros(<%=tamano%>)" name="btnasignar" />
		</P>
		<%
			String Ruta2 = "'" + request.getContextPath()
					+ "/admin/manageUsers.do'";
		%>
		<br />
		<div align="center">
			<input type="image" onclick="enviar(<%=Ruta2%>)"
				src="<%=request.getContextPath() + "/images/b_atras.gif"%>" />
		</div>
	</form>
</body>
</html>